<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
 <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<style>
body{padding: 0px;margin: 0px;}

#footer{width: auto;min-height: 60px;line-height:60px;text-

align:center;font-family:Arial, Helvetica, sans-serif}
#footer{border-top: thin solid #39A631;}#footer a{color:black;}
.con{width: 35%;height: 20em;margin-top:4em;min-width:260px;}
.con{border: thin solid #0080FF;}


 html,body{

               width: 100%;
               height: 100%

            } 
        body{
           
            background-size: 100%;
            background-color: #97CBFF;
           }


.con_title{background-color: #2894FF;width: auto;height: 3.5em;line-height: 

3.5em;text-align: center;min-width:260px;}
con_title_sp{font-family: "微软雅黑";font-size: 1.5em;font-weight: 

800;color: #FFF;}
.con_input{margin: 2em 0 1em 0;}

.submit-btn{width: 8em;height: 2em;background-color: #0080FF;border-radius: 

4px;border: 0px;color: #fff;font-family:"微软雅黑";font-size: 1em;font-

weight: bold;}
.con_input span{font-family: "微软雅黑";font-size: 1em;font-weight: 

bold;color: #333;}
.con_input input{width: 15em;padding: 0.5em 1em;border: 1px solid #bbb;}
.submit-btn{margin: 1em 0 1em 0;}
.con_select{margin-left: 2em;font-family:"微软雅黑";font-size: 1em;color: 

#333;}
</style>

<title>学工系统登录</title><base target="_blank" />
<script>
     $(function(){
    	 
    	 $("#hovertreestu").blur(function(){
    		 
    	 var user=$("#auser").val();
   	     var password=$("#apassword").val();
   	     var a=$("input[name='t1']:checked").val();
    	 $.ajax({
		    	
		    	url: "/getLogin",
		    	data:{"username": user,"password": password},
		    	type: "post",
		    	success: function(res)
				 {
		    		if(res==1&&a=="学生"){window.location.href="student.html"; }
		    		else{alert("用户名或密码不正确!");}
				 }	
				 })
     })
     
      $("#hovertreetea").blur(function(){
    	  
    	  var user=$("#auser").val();
    	  var password=$("#apassword").val();
    	  if(user!='123456'||password!='123456')
    		  {
    		  alert("用户名或密码错误!");
    		  }
    	  
      })
      
      $("#hovertreeadm").blur(function(){
    	  
    	  var user=$("#auser").val();
    	  var password=$("#apassword").val();
    	  if(user!='654321'||password!='654321')
    		  {
    		  alert("用户名或密码错误!");
    		  }
    	  
      })
     })
   
      function login()
      {
    	  var a=$("input[name='t1']:checked").val();
    	  var user=$("#auser").val();
    	  var password=$("#apassword").val();
    	 
    	  if(user='123456'&&password=='123456'&&a=='教师')
		  {
		  
		   window.location.href="teacher.html";
		  }
	      if(user='654321'&&password=='654321'&&a=='管理员')
	    	 {
	    	    window.location.href="Administrator.html";
	    	 }
	      
	     
	      }
      
</script>



</head>
<body>

<div id="header">
<div class="header_title">
</div>

<div id="content">
<center>
<div class="con">
<div class="con_title">
<span class="con_title_sp">欢迎登录学工系统</span>
</div>
<div class="con_panel">
<div class="con_input">
<span>用户名：</span><input type="text" id="auser" placeholder="学号/工号"/>
</div>
<div class="con_input">
<span>密    码：</span><input type="password" id="apassword" placeholder="密码"/>
</div>
<div class="con_select">
<input type="radio" name="t1" id="hovertreestu" value="学生" /><label 

for="hovertreestu">学生</label>
<input type="radio" name="t1" id="hovertreetea" value="教师" /><label 

for="hovertreetea">教师</label>
<input type="radio" name="t1" id="hovertreeadm" value="管理员" /><label 

for="hovertreeadm">管理员</label>

</div>
<input type="submit" value="登 录" class="submit-btn" onclick="login()" />
<a href="zhuce.html" target="_blank">还没注册?点我注册</a>
</div>
</div>
</center>
</div>
</body>
</html>